<%@page import="org.firestorm.traficforecast.utils.LocaleUtils"%>
<%@page import="org.firestorm.traficforecast.utils.Constant"%>
<%@page import="java.util.Properties"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bkav PKI in a BOX</title>
<link rel="stylesheet" style="text/css" href="css/index.css">
<link href="img/shortcut.ico" rel="Shortcut Icon" />
<script type="text/javascript">

</script>
<%
	String context = request.getContextPath();
	String notice = "";
	String errorString = request.getParameter("error");
	if (errorString != null) {
		int error = Integer.parseInt(errorString);
		switch (error) {
		case 0:
			notice = "Login Susscessfull!";
			break;
		case 13:
			notice = "Cannot connect to Database!";
			break;
		case 11:
			notice = "Your logined information was lost! sorry!";
			break;
		case 12:
			notice = "You are not logged in!";
			break;
		case Constant.LOGIN_SYSTEM_ERROR:
			notice = "System Error!";
			break;
		case Constant.USERNAME_NULL:
			notice = "Wrong loggin information!";
			break;
		case Constant.LOGIN_INVALID_USER_INFO:
			notice = "Wrong loggin information";
			break;
		case Constant.LOGIN_USER_NULL:
			notice = "You need type both user name and password";
			break;
		case Constant.LOGIN_UNACTIVED_USER:
			notice = "User is not actived! Sorry";
			break;
		case Constant.ACCESS_DENIES:
			notice = "Other use was loggined";
		break;
		}
	}
%>
<%
	Properties lang = null;
	String file = null;
	if (session.getAttribute("locale") != null) {
		String langCode = session.getAttribute("locale").toString();
		langCode = "vi";
		if ("en".equals(langCode)) {
			file = application.getRealPath("/")
					+ "lang_en_US.properties";

			lang = LocaleUtils.getLocale(file);

		} else if ("vi".equals(langCode)) {
			file = application.getRealPath("/")
					+ "lang_vi_VN.properties";

			lang = LocaleUtils.getLocale(file);
		}
	} else {
		file = application.getRealPath("/") + "lang_en_US.properties";
		lang = LocaleUtils.getLocale(file);
		session.setAttribute("locale", "en");
	}
%>
</head>
<body>

	<div id="login_div">
		<form method="post" action="checklogin.jsp" class="login">
			<p>
				<label for="login"><%=lang.getProperty("account")%>:</label> <input
					type="text" name="login" id="login" value="">
			</p>

			<p>
				<label for="password"><%=lang.getProperty("password")%>:</label> <input
					type="password" name="password" id="password" value="">
			</p>

			<p class="login-submit">
				<button type="submit" class="login-button"><%=lang.getProperty("login")%></button>
			</p>

			<p>
				<label for="notice"></label><span id="notice"><%=notice%></span>
			</p>

			<p class="forgot-password">
				<a href=""><%=lang.getProperty("forgot_password")%>?</a>
			</p>
			
		</form>
	</div>
	<div id="footer">
		
	</div>
</body>
</html>